package com.itheima.Demo;

import com.itheima.Utils.MybatisUtils;
import com.itheima.dao.UserMapper;
import com.itheima.pojo.User;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.junit.Test;

public class demo01 {
    @Test
    public void demo001(){
     //实现根据用户id获取该用户信息和 所有的订单 和 订单明细
        SqlSessionFactory sqlSessionFactory = MybatisUtils.getSqlSessionFactory();
        SqlSession sqlSession = MybatisUtils.getSqlSession();
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
        User user = mapper.find(1);
        System.out.println(user);
        sqlSession.close();
    }
}
